package com.ssy.lingxi.member.merchant.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 下级会员升级规则配置
 * @author 万宁
 * @version 2.0.0
 * @date 2020-07-07
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_level_rule_config", indexes = {@Index(name = "ms_mc_member_level_rule_config_member_id_idx", columnList = "memberId"), @Index(name = "ms_mc_member_level_rule_config_role_id_idx", columnList = "roleId"), @Index(name = "ms_mc_member_level_rule_config_status_idx", columnList = "status")})
public class MemberLevelRuleConfigDO implements Serializable {
    private static final long serialVersionUID = 5188731087332598503L;

    /**
     * 升级规则id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="member_level_rule_config_seq")
    @SequenceGenerator(sequenceName="ms_mc_member_level_rule_config_seq", name="member_level_rule_config_seq",allocationSize = 1)
    private Long id;

    /**
     * 上级会员Id
     */
    @Column
    private Long memberId;

    /**
     * 上级会员角色Id
     */
    @Column
    private Long roleId;

    /**
     * 可获取的分值或百分比
     */
    @Column(columnDefinition = "numeric")
    private BigDecimal score;

    /**
     * 状态 0-禁用 1-启用
     */
    @Column(columnDefinition = "int2")
    private Integer status;

    /**
     * 关联的系统升级规则
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "base_level_rule_id", referencedColumnName = "id", foreignKey = @ForeignKey(name = "none",value = ConstraintMode.NO_CONSTRAINT))
    private BaseLevelRuleDO rule;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public BigDecimal getScore() {
        return score;
    }

    public void setScore(BigDecimal score) {
        this.score = score;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public BaseLevelRuleDO getRule() {
        return rule;
    }

    public void setRule(BaseLevelRuleDO rule) {
        this.rule = rule;
    }
}
